package com.itheima.mapper;

import com.itheima.pojo.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserRoleMapper {
    /**
     * 根据用户id查询权限
     * @param userId
     * @return
     */
    @Select("select r.id, r.name, r.keyword, r.description from t_user_role ur left join t_role r on ur.role_id = r.id where ur.user_id = #{userId}")
    List<Role> findByUserId(Integer userId);
}
